// 1.RegExp上的test方法
const reg = /^[0-9a-zA-Z]{3,6}$/g
const s1 = "545da"
// console.log(reg.test(s1));
const s2 = "15153dw"
// console.log(reg.test(s2));


// 2.String上的replace和match方法
const reg2 = /中国|毒品/g
const str2 = "中国严厉打击贩卖毒品"
// console.log(str2.replace(reg2, "**"));

// 3.String上的match方法
const reg3 = /[0-9]+/g
const str3 = "d151da31d53a431dw35a"
// console.log(str3.match(reg3));

// 千位分隔符
const reg4 = /(\d)(?=(\d{3})+$)/g
const str4 = "1234567890"
console.log(str4.replace(reg4, "$1,"));